package com.ihr360.payroll.dao;

import com.ihr360.payroll.model.dto.salary.plan.SalaryPlan;
import com.ihr360.rest.reposity.SimpleRestReposity;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import java.util.List;

@RepositoryRestResource
public interface SalaryPlanRepository extends SimpleRestReposity<SalaryPlan, Long> {

    List<SalaryPlan> findByCompanyId(@Param(value = "companyId") String companyId);

    List<SalaryPlan> findByIsSystemTemplateAndEnabled(boolean isSystemTemplate, boolean enabled);

    List<SalaryPlan> findByIsSystemTemplate(boolean isSystemTemplate);

    List<SalaryPlan> findByIdIn(List<Long> ids);

    List<SalaryPlan> findByPayrollConfigIdIn(List<Long> payrollConfigIds);

    int countByAttendancePlanId(Long attendancePlanId);

    int countByEnabledAndAttendancePlanId(boolean enabled, Long attendancePlanId);

    int countByPayrollConfigId(Long payrollConfigId);

    int countByEnabledAndPayrollConfigId(boolean enabled, Long payrollConfigId);

    int countByCompanyIdAndName(String companyId, String name);

    long countByCompanyIdAndIdNotAndName(String companyId, Long id, String name);

    long countByIsSystemTemplateAndIdNotAndName(boolean isSystemTemplate, Long id, String name);

    long countByIsSystemTemplateAndName(boolean isSystemTemplate, String name);
}